<?php

namespace App\Http\Controllers\Wechat\Plugins;

use Laravel\Lumen\Routing\Controller as BaseController;
use App\Http\Controllers\Wechat\Messages;

class Weather extends BaseController
{
    public static function get( $message )
    {
        $weatherInfo = \App\Library\Weather::info( urlencode( '大连' ) );

        if ( $weatherInfo['error_code'] != 0 ) {
            return Messages\Text::simple( '服务器开小差了~~~' );
        }

        return Messages\News::weather( $message, $weatherInfo['result']['data'] );
    }
    public static function getHZ( $message )
    {
        $weatherInfo = \App\Library\Weather::info( urlencode( '杭州' ) );

        if ( $weatherInfo['error_code'] != 0 ) {
            return Messages\Text::simple( '服务器开小差了~~~' );
        }

        return Messages\News::weather( $message, $weatherInfo['result']['data'] );
    }

}